package com.boge.springframework.beans.factory.config;

import com.boge.springframework.beans.BeansException;
import com.boge.springframework.beans.factory.BeanFactory;

/**
 * 主要作用于BeanPostProcessors ,对SingletonBeanFactory做扩展
 * 在初始化方法的前： 执行 applyBeanPostProcessorsBeforeInitialization 扩展Bean
 * 在初始化方法后： 执行 applyBeanPostProcessorsAfterInitialization 扩展Bean
 */
public interface AutowireCapableBeanFactory extends BeanFactory {

    /**
     * 执行 BeanPostProcessors 接口实现类的 postProcessBeforeInitialization 方法
     *
     * @param existingBean
     * @param beanName
     * @return
     * @throws BeansException
     */
    Object applyBeanPostProcessorsBeforeInitialization(Object existingBean, String beanName) throws BeansException;

    /**
     * 执行 BeanPostProcessors 接口实现类的 postProcessorsAfterInitialization 方法
     *
     * @param existingBean
     * @param beanName
     * @return
     * @throws BeansException
     */
    Object applyBeanPostProcessorsAfterInitialization(Object existingBean, String beanName) throws BeansException;

}
